// 核心业务交互
function initCoreBusiness() {
    // 检查是否存在核心业务相关元素
    const coreBusinessElement = document.querySelector('.core-business-section');
    if (!coreBusinessElement) {
        console.log('Core business element not found, skipping initialization');
        return;
    }

    console.log('Core business initialized');

    const menuItems = document.querySelectorAll('.business-menu-item');
    const detailItems = document.querySelectorAll('.business-detail-item');

    // 切换业务详情
    function switchBusinessDetail(index) {
        // 更新菜单项状态
        menuItems.forEach(item => {
            item.classList.remove('active');
            if (item.dataset.index === index) {
                item.classList.add('active');
            }
        });

        // 更新详情内容
        detailItems.forEach(item => {
            item.style.display = item.dataset.index === index ? 'block' : 'none';
        });
    }

    // 为菜单项添加点击事件
    menuItems.forEach(item => {
        item.addEventListener('click', () => {
            switchBusinessDetail(item.dataset.index);
        });
    });

    // 初始化默认显示第一个业务详情
    if (menuItems.length > 0) {
        switchBusinessDetail(menuItems[0].dataset.index);
    }
}

// 确保在组件加载完成后执行
if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', initCoreBusiness);
} else {
    initCoreBusiness();
} 
